package com.iengoo.edu.service.impl;

import com.iengoo.edu.dao.TicketDao;
import com.iengoo.edu.dao.impl.TicketDaoImpl;
import com.iengoo.edu.entity.Ticket;
import com.iengoo.edu.service.TicketService;

import java.util.List;

/**
 * @author zpym
 * @CopyRight (C) http://www.iengoo.com
 * @brief
 * @email 122162005@qq.com
 * @date 2019-01-22 16:32
 */
public class TicketServiceImpl implements TicketService {
    private TicketDao dao = new TicketDaoImpl();
    @Override
    public void add(Ticket ticket) {
        dao.add(ticket);
    }

    @Override
    public void delete(int id) {
        Ticket retTicket = dao.findById(id);
        if (retTicket != null) {
            dao.delete(id);
        }
    }

    @Override
    public void update(Ticket ticket) {
        dao.update(ticket);
    }

    @Override
    public Ticket findById(int id) {
        return dao.findById(id);
    }

    @Override
    public List<Ticket> findAll() {
        return dao.findAll();
    }
}
